Skip to content

refactor: improve python integration by using magick method and properties #439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

SMoraisAnsys
Copy link
Contributor

This PR is currently a WIP. The changes are:

  • using __getitem__ instead of the get_item method that was implemented. The great thing with that change is that any use can now call speos_client[my_key] instead of speos_client.get_item(key=my_key). It's a good practice to implement magick methods when they make sense.
  • using Python property to propose something simple to our users while hidding the complexity. This way, a user will think he is playing with an attribute when, behind the scene, there is something complexe going on. It is also a good practice in Python.

Note

I used property for the Face class, if the change is accepted, we can think about applying it to all script files

@SMoraisAnsys SMoraisAnsys force-pushed the refactor/use-magick-methods branch from dd414d1 to 8a540d9 Compare February 6, 2025 11:56
@StefanThoene
Copy link
Collaborator

@SMoraisAnsys in regards to the properties: How to combine the properties with the usage of fluent API methodology currently implemented.

in regards for the getitem i didn't know about that magic method. so great idea

@SMoraisAnsys
Copy link
Contributor Author

Closing as superseded by the POC #453

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants